package daily.oct;

public class lc2011 {
    public int finalValueAfterOperations(String[] operations) {
        int countAdd=0;
        int countSub=0;
        for(int i=0;i<operations.length;i++){
            if(operations[i].contains("+")){
                countAdd++;
            }else {
                countSub++;
            }
        }
        int res=countAdd-countSub;
        return res;
    }

    public static void main(String[] args) {
        String[] operations1 = {"--X","X++","X++"};
        String[] operations2 = {"++X","++X","X++"};
        String[] operations3 = {"X++","++X","--X","X--"};

        lc2011 lc = new lc2011();
        System.out.println(lc.finalValueAfterOperations(operations1));
        System.out.println(lc.finalValueAfterOperations(operations2));
        System.out.println(lc.finalValueAfterOperations(operations3));
    }
}
